import { http } from "@/utils/http";
import { baseUrlApi, filerEmptyVal } from "../utils";

/** 库存列表查询 */
export const getStockList = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/stock/page"), {
    data: filerEmptyVal(data)
  });
};

/** 库存流水列表 */
export const getStockLog = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/stock/listStockLog"), {
    params: filerEmptyVal(params)
  });
};

/** 各仓库存列表 */
export const getStockDepository = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/stock/listDepositoryStock"), {
    params: filerEmptyVal(params)
  });
};

/** 获取业务单据 */
export const getStockBiz = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/stock/bizInfo"), {
    params: filerEmptyVal(params)
  });
};

/** 导入库存 */
export const importStockList = (data?: object) => {
  return http.request<any>(
    "post",
    baseUrlApi("/stock/importData"),
    {
      data,
      params: {
        isShowErrTips: false
      }
    },
    {
      headers: {
        "Content-Type": "multipart/form-data"
      }
    }
  );
};
